Page({
  data: {
    value: '',
    theme: 'light',
    
  },
  onLoad() {
    const eventChannel = this.getOpenerEventChannel()
    eventChannel.on('init', ({value}) => {
      this.setData({ value })
    })

    this.setData({
      theme: wx.getSystemInfoSync().theme || 'light'
    })

    if (wx.onThemeChange) {
      wx.onThemeChange(({theme}) => {
        this.setData({theme})
      })
    }
  },
  
  back() {
    wx.navigateBack()
  },
  onSubmit(e) {
    this.getOpenerEventChannel().emit('submit', this.data.value)
    this.back()
  },
  onShareAppMessage() {
    return {
      title: '东鸣西应',
      path: '/page/home/index'
    }
  },
})
